package com.hong.chapter10;

public class SynchronizedProblem {
    public static void main(String[] args) throws InterruptedException{
        new Thread(){
            @Override
            public void run() {
                System.out.println("t1");
                SynchronizedProblem.run();
            }
        }.start();

        Thread.sleep(1000);
        Thread t2= new Thread(){
            @Override
            public void run() {
                System.out.println("t2");
                SynchronizedProblem.run();
            }
        };
        t2.start();
        Thread.sleep(2000);
        t2.interrupt();
        System.out.println(t2.isInterrupted());
    }

    public synchronized static void run(){
        System.out.println(Thread.currentThread().getName());
        while (true){

        }
    }
}
